<section class="content-header">
 <h1>添加域名</h1>
</section>
<section class="content">
 <!-- /.row -->
 <div class="row">
  <div class="col-xs-12">
   <div class="box box-primary">
     <div class="box-body">
          <div class="form-group">
           <label for="domain_name">名称</label>
           <input type="text" class="form-control" name="domain_name">
          </div>
         <div class="form-group">
             <label for="name">域名地址</label>
             <input type="text" class="form-control" name="name" placeholder="域名地址，例如 www.abc.com ">
         </div>
     </div>
     <!-- /.box-body -->
     <div class="box-footer">
      <button id="add-domain-btn" class="btn btn-primary">添加</button>
     </div>
   </div>
   <!-- /.box -->
  </div>
 </div>
</section>
<script src="/static/js/validator.js"></script>
<script type="text/javascript">
    Validator.newDomainName(function () {
        api_invoke("/api/v1/domain/add", {name: $("input[name=name]").val(),domain_name: $("input[name=domain_name]").val()}, function(data){
            if(data.errno == 0){
                load_page("/pages/domain/list.html");
                update_menu();
            }else{
                alert(data.msg);
            }
        });
    })
</script>
